<?php
/**
 * Created by PhpStorm.
 * User: THINK
 * Date: 2017/8/25
 * Time: 14:51
 */
namespace Home\Controller;

use Think\Controller;

class NewsController extends Controller
{
    public function index(){
        $index = M('article');
        $list = $index->limit(0,10)->select();
        $this->assign('list',$list);

        $Page = new \Think\Page($index,16);
        $show = $Page->show();
        $listss = $index->limit($Page->firstRow . ',' . $Page->listRows)->select();
        $this->assign('listss',$listss);
        $this->assign('page', $show);

        $indexs = M('announce');
        $lists = $indexs->order('posttime desc')->limit(0,1)->select();
        $this->assign('lists',$lists);
        $this->display();
    }
    public function show(){
        $index = M('article');
        $list = $index->limit(0,10)->where("cid = 3")->select();
        $this->assign('list',$list);

        $Page = new \Think\Page($index,16);
        $show = $Page->show();
        $listss = $index->where("cid = 3")->limit($Page->firstRow . ',' . $Page->listRows)->select();
        $this->assign('listss',$listss);
        $this->assign('page', $show);

        $indexs = M('announce');
        $lists = $indexs->order('posttime desc')->limit(0,1)->select();
        $this->assign('lists',$lists);
        $this->display();
    }
    public function shows(){
        $index = M('article');
        $list = $index->limit(0,10)->where("cid = 4")->select();
        $this->assign('list',$list);

        $Page = new \Think\Page($index,16);
        $show = $Page->show();
        $listss = $index->where("cid = 4")->limit($Page->firstRow . ',' . $Page->listRows)->select();
        $this->assign('listss',$listss);
        $this->assign('page', $show);

        $indexs = M('announce');
        $lists = $indexs->order('posttime desc')->limit(0,1)->select();
        $this->assign('lists',$lists);
        $this->display();
    }
}